package foxesAndRabbits;

import static org.junit.Assert.*;

import java.util.ArrayList;
import java.util.List;

import org.junit.Before;
import org.junit.Test;

public class FalconTest {
	
	private Falcon falcon;
	
	
	//Before the test is started make new Falcon Object
	@Before
	public void setup() {
	      falcon = new Falcon(true,new Field(50,50), new Location(0,0));
	}	
	
	
	//Testing the constructor 
	@Test
	public void testFalconConstructor() {
		boolean falconConst = false;
		falcon = new Falcon(true,new Field(50,50), new Location(0,0));
		if(falcon instanceof Falcon)falconConst = true;
		assertTrue(falconConst);
	}
	
	//Nieuwe falcon met negatieve array
	@Test(expected=NegativeArraySizeException.class)
	public void getInvalidFieldNegativeArray(){
		falcon = new Falcon(true,new Field(-50,-1550), new Location(0,0));
	}
	
	//New falcon met array of out boudn
	@Test(expected=ArrayIndexOutOfBoundsException.class)
	public void getInvalidLocation(){
		falcon = new Falcon(true,new Field(50,50), new Location(-1000,-3220));
	}
	
	//Testing the act method
	@Test(expected=ClassCastException.class)
	public void testAct(){
		List<Actor> animals = new ArrayList<Actor>();
		//Nepobject toevoegen
		Object o = new Object();
		//Failt hier al
		animals.add((Animal) o);
		falcon.act(animals);
	}
	
	//Nieuwe falcon location 
	@Test(expected=ArrayIndexOutOfBoundsException.class)
	public void testInvalidLocation(){
		falcon.setLocation(new Location(-15,52));
	}
}
